import random
import turtle


def pen_Tree(branch_length, branch_width):

    if branch_length > 5:


        turtle.color('brown')
        turtle.pensize(branch_width)
        turtle.forward(branch_length)
        print('forward：{}'.format(branch_length))
        turtle.right(20)
        print('right:20')

        pen_Tree(branch_length - 10, branch_width * 0.8)
        turtle.left(40)
        print('left:40')
        pen_Tree(branch_length - 10, branch_width * 0.8)
        turtle.right(20)
        print('right:20')
        color=['green','brown']
        random.shuffle(color)
        if branch_length < 15:
            turtle.color(color[0])
        turtle.pensize(branch_width)
        turtle.backward(branch_length)


def main():
    turtle.bgcolor('black')
    turtle.left(90)
    turtle.penup()
    turtle.backward(250)
    turtle.pendown()

    pen_Tree(70, 5)
    turtle.speed(10)
    turtle.exitonclick()


if __name__ == '__main__':
    main()
